<?php
include('./mysqli_connect.php');
include('./Session.php');
include ('./functions.php');

if(isset($_GET['name'])){
    $uname = mysqli_real_escape_string($dbc,$_GET['name']);
    $query = "SELECT u.user_id,u.user_name,u.user_avatar,u.user_online"
            . " FROM `user` as u INNER JOIN `connect` as c USING(user_id)"
            . " WHERE c.group_id =1 AND u.user_name LIKE '%$uname%'"
            . " ORDER BY u.user_online DESC,u.user_name ASC ";
    $result = mysqli_query($dbc, $query);
    if(mysqli_num_rows($result)>0){
        while ($u_list = mysqli_fetch_array($result,MYSQLI_ASSOC))
        {
            echo "<li><div class='chat-left-uavatar'>
            <img src='Images/Uploads/".show_avatar($u_list['user_avatar'])."' width='40' height='40' alt='user-avatar'></div>
            <div class='chat-left-uname'>"
                .ucfirst($u_list['user_name']).
            "</div>"
            .check_online($u_list['user_online']).
            "</li>";
        }
    }
}


